home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / gnu / gnulib / dkbtrace / pbmplus / source / libtiff / tif_prin.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-07-16  |  16.5 KB  |  580 lines

  1. #ifndef lint
  2. static char rcsid[] = "$Header: /usr/people/sam/tiff/libtiff/RCS/tif_print.c,v 1.32 91/07/16 16:30:59 sam Exp $";
  3. #endif
  4.  
  5. /*
  6.  * Copyright (c) 1988, 1989, 1990, 1991 Sam Leffler
  7.  * Copyright (c) 1991 Silicon Graphics, Inc.
  8.  *
  9.  * Permission to use, copy, modify, distribute, and sell this software and 
  10.  * its documentation for any purpose is hereby granted without fee, provided
  11.  * that (i) the above copyright notices and this permission notice appear in
  12.  * all copies of the software and related documentation, and (ii) the names of
  13.  * Sam Leffler and Silicon Graphics may not be used in any advertising or
  14.  * publicity relating to the software without the specific, prior written
  15.  * permission of Sam Leffler and Silicon Graphics.
  16.  * 
  17.  * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
  18.  * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
  19.  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
  20.  * 
  21.  * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
  22.  * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
  23.  * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  24.  * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
  25.  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
  26.  * OF THIS SOFTWARE.
  27.  */
  28.  
  29. /*
  30.  * TIFF Library.
  31.  *
  32.  * Directory Printing Support
  33.  */
  34. #include <stdio.h>
  35. #include "tiffioP.h"
  36.  
  37. static char *ResponseUnitNames[] = {
  38.     "#0",
  39.     "10ths",
  40.     "100ths",
  41.     "1,000ths",
  42.     "10,000ths",
  43.     "100,000ths",
  44. };
  45. static    float ResponseUnit[] = { 1., .1, .01, .001, .0001, .00001 };
  46. #define    MAXRESPONSEUNIT \
  47.     (sizeof (ResponseUnitNames) / sizeof (ResponseUnitNames[0]))
  48.  
  49. #ifdef JPEG_SUPPORT
  50. static
  51. JPEGPrintQTable(fd, prec, tab)
  52.     FILE *fd;
  53.     int prec;
  54.     u_short tab[64];
  55. {
  56.     int i, j;
  57.     char *sep;
  58.  
  59.     fputc('\n', fd);
  60.     for (i = 0; i < 8; i++) {
  61.         sep = "    ";
  62.         for (j = 0; j < 8; j++) {
  63.             fprintf(fd, "%s%2u", sep, tab[8*i+j]);
  64.             sep = ", ";
  65.         }
  66.         fputc('\n', fd);
  67.     }
  68. }
  69.  
  70. static
  71. JPEGPrintCTable(fd, tab)
  72.     FILE *fd;
  73.     u_char *tab;
  74. {
  75.     int i, n, count;
  76.     char *sep;
  77.  
  78.     fprintf(fd, "\n    Bits:");
  79.     count = 0;
  80.     for (i = 0; i < 16; i++) {
  81.         fprintf(fd, " %u", tab[i]);
  82.         count += tab[i];
  83.     }
  84.     n = 0;
  85.     for (; count > 0; count--) {
  86.         if ((n % 8) == 0) {
  87.             fputc('\n', fd);
  88.             sep = "    ";
  89.         }
  90.         fprintf(fd, "%s0x%02x", sep, tab[i++]);
  91.         sep = ", ";
  92.         n++;
  93.  
  94.     }
  95.     if (n % 8)
  96.         fputc('\n', fd);
  97. }
  98. #endif
  99.  
  100. /*
  101.  * Print the contents of the current directory
  102.  * to the specified stdio file stream.
  103.  */
  104. void
  105. TIFFPrintDirectory(tif, fd, flags)
  106.     TIFF *tif;
  107.     FILE *fd;
  108.     long flags;
  109. {
  110.     register TIFFDirectory *td;
  111.     char *sep;
  112.     int i;
  113.     long n;
  114.     float unit;
  115.  
  116.     fprintf(fd, "TIFF Directory at offset 0x%x\n", tif->tif_diroff);
  117.     td = &tif->tif_dir;
  118.     if (TIFFFieldSet(tif,FIELD_SUBFILETYPE)) {
  119.         fprintf(fd, "  Subfile Type:");
  120.         sep = " ";
  121.         if (td->td_subfiletype & FILETYPE_REDUCEDIMAGE) {
  122.             fprintf(fd, "%sreduced-resolution image", sep);
  123.             sep = "/";
  124.         }
  125.         if (td->td_subfiletype & FILETYPE_PAGE) {
  126.             fprintf(fd, "%smulti-page document", sep);
  127.             sep = "/";
  128.         }
  129.         if (td->td_subfiletype & FILETYPE_MASK) {
  130.             fprintf(fd, "%stransparency mask", sep);
  131.             sep = "/";
  132.         }
  133.         fprintf(fd, " (%u = 0x%x)\n",
  134.             td->td_subfiletype, td->td_subfiletype);
  135.     }
  136.     if (TIFFFieldSet(tif,FIELD_IMAGEDIMENSIONS)) {
  137.         fprintf(fd, "  Image Width: %lu Image Length: %lu",
  138.             td->td_imagewidth, td->td_imagelength);
  139.         if (TIFFFieldSet(tif,FIELD_IMAGEDEPTH))
  140.             fprintf(fd, " Image Depth: %lu", td->td_imagedepth);
  141.         fprintf(fd, "\n");
  142.     }
  143.     if (TIFFFieldSet(tif,FIELD_TILEDIMENSIONS)) {
  144.         fprintf(fd, "  Tile Width: %lu Tile Length: %lu",
  145.             td->td_tilewidth, td->td_tilelength);
  146.         if (TIFFFieldSet(tif,FIELD_TILEDEPTH))
  147.             fprintf(fd, " Tile Depth: %lu", td->td_tiledepth);
  148.         fprintf(fd, "\n");
  149.     }
  150.     if (TIFFFieldSet(tif,FIELD_RESOLUTION)) {
  151.         fprintf(fd, "  Resolution: %g, %g",
  152.             td->td_xresolution, td->td_yresolution);
  153.         if (TIFFFieldSet(tif,FIELD_RESOLUTIONUNIT)) {
  154.             switch (td->td_resolutionunit) {
  155.             case RESUNIT_NONE:
  156.                 fprintf(fd, " (unitless)");
  157.                 break;
  158.             case RESUNIT_INCH:
  159.                 fprintf(fd, " pixels/inch");
  160.                 break;
  161.             case RESUNIT_CENTIMETER:
  162.                 fprintf(fd, " pixels/cm");
  163.                 break;
  164.             default:
  165.                 fprintf(fd, " (unit %u = 0x%x)",
  166.                     td->td_resolutionunit,
  167.                     td->td_resolutionunit);
  168.                 break;
  169.             }
  170.         }
  171.         fprintf(fd, "\n");
  172.     }
  173.     if (TIFFFieldSet(tif,FIELD_POSITION))
  174.         fprintf(fd, "  Position: %g, %g\n",
  175.             td->td_xposition, td->td_yposition);
  176.     if (TIFFFieldSet(tif,FIELD_BITSPERSAMPLE))
  177.         fprintf(fd, "  Bits/Sample: %u\n", td->td_bitspersample);
  178.     if (TIFFFieldSet(tif,FIELD_DATATYPE)) {
  179.         fprintf(fd, "  Data Type: ");
  180.         switch (td->td_datatype) {
  181.         case DATATYPE_VOID:
  182.             fprintf(fd, "void\n");
  183.             break;
  184.         case DATATYPE_INT:
  185.             fprintf(fd, "signed integer\n");
  186.             break;
  187.         case DATATYPE_UINT:
  188.             fprintf(fd, "unsigned integer\n");
  189.             break;
  190.         case DATATYPE_IEEEFP:
  191.             fprintf(fd, "IEEE floating point\n");
  192.             break;
  193.         default:
  194.             fprintf(fd, "%u (0x%x)\n",
  195.                 td->td_datatype, td->td_datatype);
  196.             break;
  197.         }
  198.     }
  199.     if (TIFFFieldSet(tif,FIELD_COMPRESSION)) {
  200.         fprintf(fd, "  Compression Scheme: ");
  201.         switch (td->td_compression) {
  202.         case COMPRESSION_NONE:
  203.             fprintf(fd, "none\n");
  204.             break;
  205.         case COMPRESSION_CCITTRLE:
  206.             fprintf(fd, "CCITT modified Huffman encoding\n");
  207.             break;
  208.         case COMPRESSION_CCITTFAX3:
  209.             fprintf(fd, "CCITT Group 3 facsimile encoding\n");
  210.             break;
  211.         case COMPRESSION_CCITTFAX4:
  212.             fprintf(fd, "CCITT Group 4 facsimile encoding\n");
  213.             break;
  214.         case COMPRESSION_CCITTRLEW:
  215.             fprintf(fd, "CCITT modified Huffman encoding %s\n",
  216.                 "w/ word alignment");
  217.             break;
  218.         case COMPRESSION_PACKBITS:
  219.             fprintf(fd, "Macintosh PackBits encoding\n");
  220.             break;
  221.         case COMPRESSION_THUNDERSCAN:
  222.             fprintf(fd, "ThunderScan 4-bit encoding\n");
  223.             break;
  224.         case COMPRESSION_LZW:
  225.             fprintf(fd, "Lempel-Ziv & Welch encoding\n");
  226.             break;
  227.         case COMPRESSION_PICIO:
  228.             fprintf(fd, "Pixar picio encoding\n");
  229.             break;
  230.         case COMPRESSION_NEXT:
  231.             fprintf(fd, "NeXT 2-bit encoding\n");
  232.             break;
  233.         case COMPRESSION_JPEG:
  234.             fprintf(fd, "JPEG encoding\n");
  235.             break;
  236.         default:
  237.             fprintf(fd, "%u (0x%x)\n",
  238.                 td->td_compression, td->td_compression);
  239.             break;
  240.         }
  241.     }
  242.     if (TIFFFieldSet(tif,FIELD_PHOTOMETRIC)) {
  243.         fprintf(fd, "  Photometric Interpretation: ");
  244.         switch (td->td_photometric) {
  245.         case PHOTOMETRIC_MINISWHITE:
  246.             fprintf(fd, "min-is-white\n");
  247.             break;
  248.         case PHOTOMETRIC_MINISBLACK:
  249.             fprintf(fd, "min-is-black\n");
  250.             break;
  251.         case PHOTOMETRIC_RGB:
  252.             fprintf(fd, "RGB color\n");
  253.             break;
  254.         case PHOTOMETRIC_PALETTE:
  255.             fprintf(fd, "palette color (RGB from colormap)\n");
  256.             break;
  257.         case PHOTOMETRIC_MASK:
  258.             fprintf(fd, "transparency mask\n");
  259.             break;
  260.         case PHOTOMETRIC_SEPARATED:
  261.             fprintf(fd, "separated\n");
  262.             break;
  263.         case PHOTOMETRIC_YCBCR:
  264.             fprintf(fd, "YCbCr\n");
  265.             break;
  266.         default:
  267.             fprintf(fd, "%u (0x%x)\n",
  268.                 td->td_photometric, td->td_photometric);
  269.             break;
  270.         }
  271.     }
  272.     if (TIFFFieldSet(tif,FIELD_MATTEING))
  273.         fprintf(fd, "  Matteing: %s\n", td->td_matteing ?
  274.             "pre-multiplied with alpha channel" : "none");
  275.     if (TIFFFieldSet(tif,FIELD_INKSET)) {
  276.         fprintf(fd, "  Ink Set: ");
  277.         switch (td->td_inkset) {
  278.         case INKSET_CMYK:
  279.             fprintf(fd, "CMYK\n");
  280.             break;
  281.         default:
  282.             fprintf(fd, "%u (0x%x)\n",
  283.                 td->td_inkset, td->td_inkset);
  284.             break;
  285.         }
  286.     }
  287.     if (TIFFFieldSet(tif,FIELD_THRESHHOLDING)) {
  288.         fprintf(fd, "  Thresholding: ");
  289.         switch (td->td_threshholding) {
  290.         case THRESHHOLD_BILEVEL:
  291.             fprintf(fd, "bilevel art scan\n");
  292.             break;
  293.         case THRESHHOLD_HALFTONE:
  294.             fprintf(fd, "halftone or dithered scan\n");
  295.             break;
  296.         case THRESHHOLD_ERRORDIFFUSE:
  297.             fprintf(fd, "error diffused\n");
  298.             break;
  299.         default:
  300.             fprintf(fd, "%u (0x%x)\n",
  301.                 td->td_threshholding, td->td_threshholding);
  302.             break;
  303.         }
  304.     }
  305.     if (TIFFFieldSet(tif,FIELD_FILLORDER)) {
  306.         fprintf(fd, "  FillOrder: ");
  307.         switch (td->td_fillorder) {
  308.         case FILLORDER_MSB2LSB:
  309.             fprintf(fd, "msb-to-lsb\n");
  310.             break;
  311.         case FILLORDER_LSB2MSB:
  312.             fprintf(fd, "lsb-to-msb\n");
  313.             break;
  314.         default:
  315.             fprintf(fd, "%u (0x%x)\n",
  316.                 td->td_fillorder, td->td_fillorder);
  317.             break;
  318.         }
  319.     }
  320.     if (TIFFFieldSet(tif,FIELD_PREDICTOR)) {
  321.         fprintf(fd, "  Predictor: ");
  322.         switch (td->td_predictor) {
  323.         case 1:
  324.             fprintf(fd, "none\n");
  325.             break;
  326.         case 2:
  327.             fprintf(fd, "horizontal differencing\n");
  328.             break;
  329.         default:
  330.             fprintf(fd, "%u (0x%x)\n",
  331.                 td->td_predictor, td->td_predictor);
  332.             break;
  333.         }
  334.     }
  335. #ifdef JPEG_SUPPORT
  336.     if (TIFFFieldSet(tif,FIELD_JPEGPROC)) {
  337.         fprintf(fd, "  JPEG Processing Mode: ");
  338.         switch (td->td_jpegproc) {
  339.         case JPEGPROC_BASELINE:
  340.             fprintf(fd, "baseline algorithm\n");
  341.             break;
  342.         default:
  343.             fprintf(fd, "%u (0x%x)\n",
  344.                 td->td_jpegproc, td->td_jpegproc);
  345.             break;
  346.         }
  347.     }
  348.     if (TIFFFieldSet(tif,FIELD_JPEGQTABLEPREC)) {
  349.         fprintf(fd, "  JPEG Quantization Table Precision: ");
  350.         switch (td->td_jpegprec) {
  351.         case JPEGQTABLEPREC_8BIT:
  352.             fprintf(fd, "8-bit\n");
  353.             break;
  354.         case JPEGQTABLEPREC_16BIT:
  355.             fprintf(fd, "16-bit\n");
  356.             break;
  357.         default:
  358.             fprintf(fd, "%u (0x%x)\n",
  359.                 td->td_jpegprec, td->td_jpegprec);
  360.             break;
  361.         }
  362.     }
  363.     if (TIFFFieldSet(tif,FIELD_JPEGQTABLES)) {
  364.         fprintf(fd, "  JPEG Quantization Tables: ");
  365.         if (flags & TIFFPRINT_JPEGQTABLES) {
  366.             for (i = 0; i < td->td_samplesperpixel; i++)
  367.                 JPEGPrintQTable(fd,
  368.                     td->td_jpegprec,td->td_qtab[i]);
  369.         } else
  370.             fprintf(fd, "(present)\n");
  371.     }
  372.     if (TIFFFieldSet(tif,FIELD_JPEGDCTABLES)) {
  373.         fprintf(fd, "  JPEG DC Tables: ");
  374.         if (flags & TIFFPRINT_JPEGDCTABLES) {
  375.             for (i = 0; i < td->td_samplesperpixel; i++)
  376.                 JPEGPrintCTable(fd, td->td_dctab[i]);
  377.         } else
  378.             fprintf(fd, "(present)\n");
  379.     }
  380.     if (TIFFFieldSet(tif,FIELD_JPEGACTABLES)) {
  381.         fprintf(fd, "  JPEG AC Tables: ");
  382.         if (flags & TIFFPRINT_JPEGACTABLES) {
  383.             for (i = 0; i < td->td_samplesperpixel; i++)
  384.                 JPEGPrintCTable(fd, td->td_actab[i]);
  385.         } else
  386.             fprintf(fd, "(present)\n");
  387.     }
  388. #endif
  389.     if (TIFFFieldSet(tif,FIELD_ARTIST))
  390.         fprintf(fd, "  Artist: \"%s\"\n", td->td_artist);
  391.     if (TIFFFieldSet(tif,FIELD_DATETIME))
  392.         fprintf(fd, "  Date & Time: \"%s\"\n", td->td_datetime);
  393.     if (TIFFFieldSet(tif,FIELD_HOSTCOMPUTER))
  394.         fprintf(fd, "  Host Computer: \"%s\"\n", td->td_hostcomputer);
  395.     if (TIFFFieldSet(tif,FIELD_SOFTWARE))
  396.         fprintf(fd, "  Software: \"%s\"\n", td->td_software);
  397.     if (TIFFFieldSet(tif,FIELD_DOCUMENTNAME))
  398.         fprintf(fd, "  Document Name: \"%s\"\n", td->td_documentname);
  399.     if (TIFFFieldSet(tif,FIELD_IMAGEDESCRIPTION))
  400.         fprintf(fd, "  Image Description: \"%s\"\n",
  401.             td->td_imagedescription);
  402.     if (TIFFFieldSet(tif,FIELD_MAKE))
  403.         fprintf(fd, "  Make: \"%s\"\n", td->td_make);
  404.     if (TIFFFieldSet(tif,FIELD_MODEL))
  405.         fprintf(fd, "  Model: \"%s\"\n", td->td_model);
  406.     if (TIFFFieldSet(tif,FIELD_ORIENTATION)) {
  407.         fprintf(fd, "  Orientation: ");
  408.         switch (td->td_orientation) {
  409.         case ORIENTATION_TOPLEFT:
  410.             fprintf(fd, "row 0 top, col 0 lhs\n");
  411.             break;
  412.         case ORIENTATION_TOPRIGHT:
  413.             fprintf(fd, "row 0 top, col 0 rhs\n");
  414.             break;
  415.         case ORIENTATION_BOTRIGHT:
  416.             fprintf(fd, "row 0 bottom, col 0 rhs\n");
  417.             break;
  418.         case ORIENTATION_BOTLEFT:
  419.             fprintf(fd, "row 0 bottom, col 0 lhs\n");
  420.             break;
  421.         case ORIENTATION_LEFTTOP:
  422.             fprintf(fd, "row 0 lhs, col 0 top\n");
  423.             break;
  424.         case ORIENTATION_RIGHTTOP:
  425.             fprintf(fd, "row 0 rhs, col 0 top\n");
  426.             break;
  427.         case ORIENTATION_RIGHTBOT:
  428.             fprintf(fd, "row 0 rhs, col 0 bottom\n");
  429.             break;
  430.         case ORIENTATION_LEFTBOT:
  431.             fprintf(fd, "row 0 lhs, col 0 bottom\n");
  432.             break;
  433.         default:
  434.             fprintf(fd, "%u (0x%x)\n",
  435.                 td->td_orientation, td->td_orientation);
  436.             break;
  437.         }
  438.     }
  439.     if (TIFFFieldSet(tif,FIELD_SAMPLESPERPIXEL))
  440.         fprintf(fd, "  Samples/Pixel: %u\n", td->td_samplesperpixel);
  441.     if (TIFFFieldSet(tif,FIELD_ROWSPERSTRIP)) {
  442.         fprintf(fd, "  Rows/Strip: ");
  443.         if (td->td_rowsperstrip == 0xffffffffL)
  444.             fprintf(fd, "(infinite)\n");
  445.         else
  446.             fprintf(fd, "%u\n", td->td_rowsperstrip);
  447.     }
  448.     if (TIFFFieldSet(tif,FIELD_MINSAMPLEVALUE))
  449.         fprintf(fd, "  Min Sample Value: %u\n", td->td_minsamplevalue);
  450.     if (TIFFFieldSet(tif,FIELD_MAXSAMPLEVALUE))
  451.         fprintf(fd, "  Max Sample Value: %u\n", td->td_maxsamplevalue);
  452.     if (TIFFFieldSet(tif,FIELD_PLANARCONFIG)) {
  453.         fprintf(fd, "  Planar Configuration: ");
  454.         switch (td->td_planarconfig) {
  455.         case PLANARCONFIG_CONTIG:
  456.             fprintf(fd, "single image plane\n");
  457.             break;
  458.         case PLANARCONFIG_SEPARATE:
  459.             fprintf(fd, "separate image planes\n");
  460.             break;
  461.         default:
  462.             fprintf(fd, "%u (0x%x)\n",
  463.                 td->td_planarconfig, td->td_planarconfig);
  464.             break;
  465.         }
  466.     }
  467.     if (TIFFFieldSet(tif,FIELD_PAGENAME))
  468.         fprintf(fd, "  Page Name: \"%s\"\n", td->td_pagename);
  469.     if (TIFFFieldSet(tif,FIELD_GRAYRESPONSEUNIT)) {
  470.         fprintf(fd, "  Gray Response Unit: ");
  471.         if (td->td_grayresponseunit < MAXRESPONSEUNIT)
  472.             fprintf(fd, "%s\n",
  473.                 ResponseUnitNames[td->td_grayresponseunit]);
  474.         else
  475.             fprintf(fd, "%u (0x%x)\n",
  476.                 td->td_grayresponseunit, td->td_grayresponseunit);
  477.     }
  478.     if (TIFFFieldSet(tif,FIELD_GRAYRESPONSECURVE)) {
  479.         fprintf(fd, "  Gray Response Curve: ");
  480.         if (flags & TIFFPRINT_CURVES) {
  481.             fprintf(fd, "\n");
  482.             unit = ResponseUnit[td->td_grayresponseunit];
  483.             n = 1L<<td->td_bitspersample;
  484.             for (i = 0; i < n; i++)
  485.                 fprintf(fd, "    %2d: %g (%u)\n",
  486.                     i,
  487.                     td->td_grayresponsecurve[i] * unit,
  488.                     td->td_grayresponsecurve[i]);
  489.         } else
  490.             fprintf(fd, "(present)\n");
  491.     }
  492.     if (TIFFFieldSet(tif,FIELD_GROUP3OPTIONS)) {
  493.         fprintf(fd, "  Group 3 Options:");
  494.         sep = " ";
  495.         if (td->td_group3options & GROUP3OPT_2DENCODING)
  496.             fprintf(fd, "%s2-d encoding", sep), sep = "+";
  497.         if (td->td_group3options & GROUP3OPT_FILLBITS)
  498.             fprintf(fd, "%sEOL padding", sep), sep = "+";
  499.         if (td->td_group3options & GROUP3OPT_UNCOMPRESSED)
  500.             fprintf(fd, "%sno compression", sep), sep = "+";
  501.         fprintf(fd, " (%u = 0x%x)\n",
  502.             td->td_group3options, td->td_group3options);
  503.     }
  504.     if (TIFFFieldSet(tif,FIELD_CLEANFAXDATA)) {
  505.         fprintf(fd, "  Fax Data: ");
  506.         switch (td->td_cleanfaxdata) {
  507.         case CLEANFAXDATA_CLEAN:
  508.             fprintf(fd, "clean\n");
  509.             break;
  510.         case CLEANFAXDATA_REGENERATED:
  511.             fprintf(fd, "receiver regenerated\n");
  512.             break;
  513.         case CLEANFAXDATA_UNCLEAN:
  514.             fprintf(fd, "uncorrected errors\n");
  515.             break;
  516.         default:
  517.             fprintf(fd, "(%u = 0x%x)\n",
  518.                 td->td_cleanfaxdata, td->td_cleanfaxdata);
  519.             break;
  520.         }
  521.     }
  522.     if (TIFFFieldSet(tif,FIELD_BADFAXLINES))
  523.         fprintf(fd, "  Bad Fax Lines: %u\n", td->td_badfaxlines);
  524.     if (TIFFFieldSet(tif,FIELD_BADFAXRUN))
  525.         fprintf(fd, "  Consecutive Bad Fax Lines: %u\n",
  526.             td->td_badfaxrun);
  527.     if (TIFFFieldSet(tif,FIELD_GROUP4OPTIONS))
  528.         fprintf(fd, "  Group 4 Options: 0x%x\n", td->td_group4options);
  529.     if (TIFFFieldSet(tif,FIELD_PAGENUMBER))
  530.         fprintf(fd, "  Page Number: %u-%u\n",
  531.             td->td_pagenumber[0], td->td_pagenumber[1]);
  532.     if (TIFFFieldSet(tif,FIELD_COLORMAP)) {
  533.         fprintf(fd, "  Color Map: ");
  534.         if (flags & TIFFPRINT_COLORMAP) {
  535.             fprintf(fd, "\n");
  536.             n = 1L<<td->td_bitspersample;
  537.             for (i = 0; i < n; i++)
  538.                 fprintf(fd, "   %5d: %5u %5u %5u\n",
  539.                     i,
  540.                     td->td_redcolormap[i],
  541.                     td->td_greencolormap[i],
  542.                     td->td_bluecolormap[i]);
  543.         } else
  544.             fprintf(fd, "(present)\n");
  545.     }
  546.     if (TIFFFieldSet(tif,FIELD_COLORRESPONSEUNIT)) {
  547.         fprintf(fd, "  Color Response Unit: ");
  548.         if (td->td_colorresponseunit < MAXRESPONSEUNIT)
  549.             fprintf(fd, "%s\n",
  550.                 ResponseUnitNames[td->td_colorresponseunit]);
  551.         else
  552.             fprintf(fd, "%u (0x%x)\n",
  553.                 td->td_colorresponseunit, td->td_colorresponseunit);
  554.     }
  555.     if (TIFFFieldSet(tif,FIELD_COLORRESPONSECURVE)) {
  556.         fprintf(fd, "  Color Response Curve: ");
  557.         if (flags & TIFFPRINT_CURVES) {
  558.             fprintf(fd, "\n");
  559.             unit = ResponseUnit[td->td_colorresponseunit];
  560.             n = 1L<<td->td_bitspersample;
  561.             for (i = 0; i < n; i++)
  562.                 fprintf(fd, "    %2d: %6.4f %6.4f %6.4f\n",
  563.                     i,
  564.                     td->td_redresponsecurve[i] * unit,
  565.                     td->td_greenresponsecurve[i] * unit,
  566.                     td->td_blueresponsecurve[i] * unit);
  567.         } else
  568.             fprintf(fd, "(present)\n");
  569.     }
  570.     if ((flags & TIFFPRINT_STRIPS) &&
  571.         TIFFFieldSet(tif,FIELD_STRIPOFFSETS)) {
  572.         fprintf(fd, "  %u %s:\n",
  573.             td->td_nstrips,
  574.             isTiled(tif) ? "Tiles" : "Strips");
  575.         for (i = 0; i < td->td_nstrips; i++)
  576.             fprintf(fd, "    %3d: [%8u, %8u]\n",
  577.                 i, td->td_stripoffset[i], td->td_stripbytecount[i]);
  578.     }
  579. }
  580.